Skip to content

Rc/0.1.6 - #1

Merged
kzhdev merged 9 commits into
mainfrom
rc/0.1.6
Aug 30, 2026
Merged

kzhdev merged 9 commits into
mainfrom
rc/0.1.6

Conversation

@kzhdev

@kzhdev kzhdev commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

kzhdev added 9 commits August 29, 2026 15:15
…refixes

- is_valid_name() rejected every name containing a backslash, so
  shared_memory("Global\\my_shm", 1024, create_only) failed with
  errc::invalid_name even though the README and platform notes advertise and
  demonstrate exactly that form.
- Allow a leading Global\, Local\ or Session\<id>\ object namespace prefix,
  matched case-insensitively as the kernel does; a backslash past the prefix,
  or a prefix with no object name after it, is still invalid.
- Add tests for the accepted prefixes, malformed prefixes, and creating and
  opening a Local\ prefixed segment.
- Update platform notes, README and changelog to match.
- create() returned map_impl() directly, so a mapping failure on a segment
  this call had just created skipped the unlink that the fstat/ftruncate
  error paths perform; close() never unlinks, leaving the segment in
  /dev/shm until removed by hand.
- Route the mapping failure through cleanup_error(), which unlinks only
  when owns_shm_ is set.
- Add a POSIX regression test asserting that a failed create leaves nothing
  behind; verified it fails before the fix and passes after.
- Update platform notes and changelog.
- open() returned map_impl() directly, so a mapping failure left the fd open
  until the object was destroyed - inconsistent with the fstat() error path
  just above, and observable for a no-throw construction whose failed object
  stays alive.
- Add a regression test that counts descriptors while the failed object is
  still in scope; verified it fails before the fix and passes after.
- create() passed PAGE_READONLY to CreateFileMapping when a segment was
  created read_only, making the section read-only for every process forever;
  no later opener could map it for writing. The same code on POSIX opens
  O_RDWR and only mmaps PROT_READ, leaving the segment writable for others.
- Always create the section PAGE_READWRITE and let get_map_access() restrict
  this process's view, so read_only means the same thing on both platforms.
  Verified the creator's own view is still read-only (PAGE_READONLY / r--s).
- Add a test that a read-only creator does not lock out a read-write opener;
  verified it fails before the fix and passes after.
- Document the semantics in the API reference and platform notes.
- api_reference.md said "Always create (truncate if exists)", but only Linux
  resizes an existing segment: macOS resizes only when no other process holds
  it open, and Windows never resizes at all - neither growing nor shrinking.
  size() can therefore come back smaller than requested, and on Linux an
  existing segment can be shrunk while other processes have it mapped.
- Add a per-platform table and the size() check idiom to the API reference,
  broaden the macOS-only note in the platform notes, and add a README
  best-practice line.
- Pin the per-platform outcome with a test; macOS is left unasserted since it
  depends on whether the segment is held open elsewhere.
- unique_name() and shm_cleanup were copy-pasted verbatim across four test
  files; move them to tests/test_helpers.hpp in a named slick_shm_test
  namespace, with unique_name marked inline.
- Drop the now-unused <chrono> includes and the anonymous namespaces left
  empty; count_open_fds() stays local to test_error_handling.cpp.
- List the header in the test target so it appears in IDE project views.
- The view dropped its owned std::string for a borrowed const char*, which
  went stale whenever the source shared_memory was moved: small names live
  inside the string object, so a move left the pointer aimed at the moved-from
  object. Length-dependent and silent - long names survived, short ones did
  not, and a std::vector<shared_memory> reallocation broke it while satisfying
  the documented "source must outlive the view" rule.
- Store the name behind shared_memory::name() in address-stable storage
  (detail::stable_name) so a move transfers a pointer and leaves the
  characters put. sizeof(shared_memory_view) 56 -> 32 with noexcept copies,
  sizeof(shared_memory) 112 -> 88.
- Reject constructing a view from a temporary at compile time.
- Add tests/test_view.cpp; the class had no coverage. Verified the move,
  move-assign and vector-realloc cases fail without the stable storage.
@kzhdev
kzhdev merged commit 16c502f into main Aug 30, 2026
12 checks passed
@kzhdev
kzhdev deleted the rc/0.1.6 branch August 30, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant